import { Image, View } from "@tarojs/components";
import ByIcon from "./ByIcon";

type ByEmptyProps = {
  text?: string;
  icon?: string;
  show?: boolean;
};

export default ({ show = true, icon, text = "暂无数据" }: ByEmptyProps) => {
  return (
    show && (
      <View className="py-12 text-second flex-center flex-col">
        {icon ? (
          <ByIcon name={icon} size={100} />
        ) : (
          <Image
            src="/static/images/nodata.png"
            className="w-[30vw] h-[30vw]"
            mode="widthFix"
          />
        )}

        <view className="mt-4">{text}</view>
      </View>
    )
  );
};
